﻿using System;
using System.Data;

using SqlHelperForCry.Common;

namespace Torch.WL.Entity
{
    [Table("Tb_Expo", "expoId", "Torch.WL.ConnectionString")]
    public class Tb_Expo : Info
    {
        #region SQL column name consts
        public const string SQLCOL_EXPOID = "expoId";
        public const string SQLCOL_LOGO = "logo";
        public const string SQLCOL_EXPONAME = "expoName";
        public const string SQLCOL_BEGINDATE = "beginDate";
        public const string SQLCOL_ENDDATE = "endDate";
        public const string SQLCOL_ADDRESS = "address";
        public const string SQLCOL_WEBSITE = "website";
        public const string SQLCOL_SUMMARY = "summary";
        public const string SQLCOL_HOWTOVISIT = "howtoVisit";
        public const string SQLCOL_JIUDIANZS = "JiuDianZS";
        public const string SQLCOL_MIANFEIBC = "MianFeiBC";
        public const string SQLCOL_TINGCHEFW = "TingCheFW";
        public const string SQLCOL_CANYIN = "CanYin";
        public const string SQLCOL_WANGLUO = "WangLuo";
        public const string SQLCOL_XISHOUJ = "XiShouJ";
        public const string SQLCOL_LIPIN = "LiPin";
        public const string SQLCOL_ZHUBANFBGS = "ZhuBanFBGS";
        public const string SQLCOL_VIPXXQ = "VIPXXQ";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public Tb_Expo() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public Tb_Expo(int expoId)
        {
            this.expoId = expoId;
        }
        #endregion

        public override void Init(DataRow row)
        {
            expoId = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_EXPOID]);
            logo = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_LOGO]);
            expoName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_EXPONAME]);
            beginDate = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_BEGINDATE]);
            endDate = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_ENDDATE]);
            address = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_ADDRESS]);
            website = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_WEBSITE]);
            summary = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SUMMARY]);
            howtoVisit = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_HOWTOVISIT]);
            JiuDianZS = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_JIUDIANZS]);
            MianFeiBC = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_MIANFEIBC]);
            TingCheFW = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TINGCHEFW]);
            CanYin = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_CANYIN]);
            WangLuo = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_WANGLUO]);
            XiShouJ = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_XISHOUJ]);
            LiPin = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_LIPIN]);
            ZhuBanFBGS = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_ZHUBANFBGS]);
            VIPXXQ = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_VIPXXQ]);
        }

        #region Properties
        #region Property <int> expoId
        [Property("expoId", 4, SqlDbType.Int, true, true)]
        public int expoId
        {
            get { return _expoId; }
            set { _expoId = value; }
        }
        private int _expoId = int.MinValue;
        #endregion

        #region Property <string> logo
        [Property("logo", 100, SqlDbType.VarChar, false, false)]
        public string logo
        {
            get { return _logo; }
            set { _logo = value; }
        }
        private string _logo = null;
        #endregion

        #region Property <string> expoName
        [Property("expoName", 100, SqlDbType.VarChar, false, false)]
        public string expoName
        {
            get { return _expoName; }
            set { _expoName = value; }
        }
        private string _expoName = null;
        #endregion

        #region Property <DateTime> beginDate
        [Property("beginDate", 16, SqlDbType.DateTime, false, false)]
        public DateTime beginDate
        {
            get { return _beginDate; }
            set { _beginDate = value; }
        }
        private DateTime _beginDate = DateTime.MinValue;
        #endregion

        #region Property <DateTime> endDate
        [Property("endDate", 16, SqlDbType.DateTime, false, false)]
        public DateTime endDate
        {
            get { return _endDate; }
            set { _endDate = value; }
        }
        private DateTime _endDate = DateTime.MinValue;
        #endregion

        #region Property <string> address
        [Property("address", 200, SqlDbType.VarChar, false, false)]
        public string address
        {
            get { return _address; }
            set { _address = value; }
        }
        private string _address = null;
        #endregion

        #region Property <string> website
        [Property("website", 200, SqlDbType.VarChar, false, false)]
        public string website
        {
            get { return _website; }
            set { _website = value; }
        }
        private string _website = null;
        #endregion

        #region Property <string> summary
        [Property("summary", 2147483647, SqlDbType.Text, false, false)]
        public string summary
        {
            get { return _summary; }
            set { _summary = value; }
        }
        private string _summary = null;
        #endregion

        #region Property <string> howtoVisit
        [Property("howtoVisit", 1000, SqlDbType.VarChar, false, false)]
        public string howtoVisit
        {
            get { return _howtoVisit; }
            set { _howtoVisit = value; }
        }
        private string _howtoVisit = null;
        #endregion

        #region Property <string> JiuDianZS
        [Property("JiuDianZS", 1000, SqlDbType.VarChar, false, false)]
        public string JiuDianZS
        {
            get { return _JiuDianZS; }
            set { _JiuDianZS = value; }
        }
        private string _JiuDianZS = null;
        #endregion

        #region Property <string> MianFeiBC
        [Property("MianFeiBC", 1000, SqlDbType.VarChar, false, false)]
        public string MianFeiBC
        {
            get { return _MianFeiBC; }
            set { _MianFeiBC = value; }
        }
        private string _MianFeiBC = null;
        #endregion

        #region Property <string> TingCheFW
        [Property("TingCheFW", 1000, SqlDbType.VarChar, false, false)]
        public string TingCheFW
        {
            get { return _TingCheFW; }
            set { _TingCheFW = value; }
        }
        private string _TingCheFW = null;
        #endregion

        #region Property <string> CanYin
        [Property("CanYin", 1000, SqlDbType.VarChar, false, false)]
        public string CanYin
        {
            get { return _CanYin; }
            set { _CanYin = value; }
        }
        private string _CanYin = null;
        #endregion

        #region Property <string> WangLuo
        [Property("WangLuo", 1000, SqlDbType.VarChar, false, false)]
        public string WangLuo
        {
            get { return _WangLuo; }
            set { _WangLuo = value; }
        }
        private string _WangLuo = null;
        #endregion

        #region Property <string> XiShouJ
        [Property("XiShouJ", 1000, SqlDbType.VarChar, false, false)]
        public string XiShouJ
        {
            get { return _XiShouJ; }
            set { _XiShouJ = value; }
        }
        private string _XiShouJ = null;
        #endregion

        #region Property <string> LiPin
        [Property("LiPin", 1000, SqlDbType.VarChar, false, false)]
        public string LiPin
        {
            get { return _LiPin; }
            set { _LiPin = value; }
        }
        private string _LiPin = null;
        #endregion

        #region Property <string> ZhuBanFBGS
        [Property("ZhuBanFBGS", 1000, SqlDbType.VarChar, false, false)]
        public string ZhuBanFBGS
        {
            get { return _ZhuBanFBGS; }
            set { _ZhuBanFBGS = value; }
        }
        private string _ZhuBanFBGS = null;
        #endregion

        #region Property <string> VIPXXQ
        [Property("VIPXXQ", 1000, SqlDbType.VarChar, false, false)]
        public string VIPXXQ
        {
            get { return _VIPXXQ; }
            set { _VIPXXQ = value; }
        }
        private string _VIPXXQ = null;
        #endregion
        #endregion


        public bool LoadByIdentity(int expoId)
        {
            return DataAccess.SelectByIdentity(this, Convert.ToInt64(expoId));
        }


        public bool DeleteByIdentity()
        {
            return DataAccess.DeleteByIdentity(this);
        }
    }
}
